Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vi-misc

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vi-misc

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url]

  • 1.14.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-37.5%
Maintainers
1
Weekly downloads
 
Created
Source

vi-misc

NPM version build status Test coverage

A set of utils...

misc.function

Utils for functions

  • function.once(...func_list) - make sure the given functions will not be executed more than onece.
  • function.limit(func_list, options) - make sure the given functions will be executed more than a certain count.

misc.number

The number utils

  • number.th - Append 'th' on a number.

misc.object

Utils for objects.

  • clone(object) - Deep clone
  • merge(object, ...sources) - Deep merge
  • each(object, handler) - Apply handlers for each property of the object.
  • hasByKey(object, ...keys) - Test if object.xxx.xxx.xxx exists, which xxx,xxx,xxx as just the param 'keys'
  • setByKeys(object, value, ...keys)
  • getByKeys(object, value, ...keys)
    • This is supposed to be used when keys are dynamic and uncertain. In other cases, use object.xx.xx.xx directly.

misc.path

The path utils

  • path.root - returns the app root, which is the directory of main module file.
  • path.absolute(target) - make target into absolute form and return.
  • path.split(target, sep = path.sep) - split target into array.

misc.async

Promisify with bluebird

  • all(target, options) - Promisify all method for callback(error, result) like cases.
  • catchError(promise) - Catch and return the error the promise throws. Otherwise returns null.

misc.time

The time utils

  • time.format - format time, time.format('YYYY-MM-DD HH:II:SS').

misc.Error

The custom error

  • new Error(message, code) - Create an error with custom code
  • new Error(message, props) - Create an error with properties assigned with argument props

FAQs

Package last updated on 04 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc